/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.CClass;
import ch.uzh.ifi.seal.ssqa.model.ModelPackage;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>CClass</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.CClassImpl#getMethodNames <em>Method Names</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.CClassImpl#getInheritences <em>Inheritences</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.CClassImpl#getFields <em>Fields</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CClassImpl extends ComponentImpl implements CClass {
	/**
	 * The cached value of the '{@link #getMethodNames() <em>Method Names</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMethodNames()
	 * @generated
	 * @ordered
	 */
	protected EList<String> methodNames;

	/**
	 * The cached value of the '{@link #getInheritences() <em>Inheritences</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInheritences()
	 * @generated
	 * @ordered
	 */
	protected EList<String> inheritences;

	/**
	 * The cached value of the '{@link #getFields() <em>Fields</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFields()
	 * @generated
	 * @ordered
	 */
	protected EList<String> fields;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CClassImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.CCLASS;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getMethodNames() {
		if (methodNames == null) {
			methodNames = new EDataTypeUniqueEList<String>(String.class, this, ModelPackage.CCLASS__METHOD_NAMES);
		}
		return methodNames;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getInheritences() {
		if (inheritences == null) {
			inheritences = new EDataTypeUniqueEList<String>(String.class, this, ModelPackage.CCLASS__INHERITENCES);
		}
		return inheritences;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getFields() {
		if (fields == null) {
			fields = new EDataTypeUniqueEList<String>(String.class, this, ModelPackage.CCLASS__FIELDS);
		}
		return fields;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.CCLASS__METHOD_NAMES:
				return getMethodNames();
			case ModelPackage.CCLASS__INHERITENCES:
				return getInheritences();
			case ModelPackage.CCLASS__FIELDS:
				return getFields();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.CCLASS__METHOD_NAMES:
				getMethodNames().clear();
				getMethodNames().addAll((Collection<? extends String>)newValue);
				return;
			case ModelPackage.CCLASS__INHERITENCES:
				getInheritences().clear();
				getInheritences().addAll((Collection<? extends String>)newValue);
				return;
			case ModelPackage.CCLASS__FIELDS:
				getFields().clear();
				getFields().addAll((Collection<? extends String>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.CCLASS__METHOD_NAMES:
				getMethodNames().clear();
				return;
			case ModelPackage.CCLASS__INHERITENCES:
				getInheritences().clear();
				return;
			case ModelPackage.CCLASS__FIELDS:
				getFields().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.CCLASS__METHOD_NAMES:
				return methodNames != null && !methodNames.isEmpty();
			case ModelPackage.CCLASS__INHERITENCES:
				return inheritences != null && !inheritences.isEmpty();
			case ModelPackage.CCLASS__FIELDS:
				return fields != null && !fields.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (methodNames: ");
		result.append(methodNames);
		result.append(", inheritences: ");
		result.append(inheritences);
		result.append(", fields: ");
		result.append(fields);
		result.append(')');
		return result.toString();
	}

} //CClassImpl
